package com.guodi.model.controller;



import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.guodi.model.vo.ApiProblemToExcelVo;
import org.springframework.web.bind.annotation.RequestMapping;
import com.guodi.core.tool.api.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;


import org.springframework.web.bind.annotation.RestController;
import com.guodi.core.boot.ctrl.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import springfox.documentation.annotations.ApiIgnore;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

import com.guodi.model.service.IIdtFillProblemService;
import com.guodi.model.entity.IdtFillProblem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.validation.annotation.Validated;


/**
* 指标填报体检关联问题 前端控制器
* @author lzy
* @date 2023-05-31
*/
@Slf4j
@Validated
@RestController
@RequestMapping("/IdtFillProblem")
@Api(value = "API - IdtFillProblemController", tags = "指标填报体检关联问题")
public class IdtFillProblemController extends BaseController {

    @Resource
    private IIdtFillProblemService iIdtFillProblemService;


    /**
    * 分页获取 指标填报体检关联问题 列表
    * @author lzy
    * @date 2023-05-31
    */
    @PostMapping("/page")
    @ApiOperation(value = "分页获取 指标填报体检关联问题 列表")
    @ApiImplicitParams({
        @ApiImplicitParam(name = "size", value = "页面大小，默认10", dataType = "int", paramType = "query"),
        @ApiImplicitParam(name = "current", value = "当前页码，默认1",  dataType = "int", paramType = "query"),
        @ApiImplicitParam(name = "year", value = "年份",  dataType = "String", paramType = "query"),
        @ApiImplicitParam(name = "divisionCode", value = "行政区划编码",  dataType = "String", paramType = "query")
    })
    public R page(@ApiIgnore Page page, String year, String divisionCode){
        IPage<ApiProblemToExcelVo> iPage = this.iIdtFillProblemService.pageDetail(page, year, divisionCode);
        return R.data(iPage);
    }



    @PostMapping("/downLoadFile")
    @ApiOperation(value = "导出excel文件表格")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "year", value = "年份",  dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "divisionCode", value = "行政区划编码",  dataType = "String", paramType = "query")
    })
    public void downLoadFile(String year, String divisionCode, HttpServletResponse response){
        this.iIdtFillProblemService.downLoadFile(year, divisionCode , response);
    }





}
